package moe.fuqiuluo.api


import moe.fuqiuluo.comm.EnvData
import moe.fuqiuluo.unidbg.session.SessionManager
import com.shr25.robot.protocol.UnidbgFetchQsign
import moe.fuqiuluo.CONFIG

fun register(uin: Long, androidId: String, guid: String, qimei36:String, qua: String = CONFIG.protocol.qua, version: String = CONFIG.protocol.version, code: String = CONFIG.protocol.code) {
    val hasRegister = uin in SessionManager

    if (!hasRegister) {
        SessionManager.register(EnvData(uin, androidId, guid!!.lowercase(), qimei36!!.lowercase(), qua, version, code))
    }
    UnidbgFetchQsign.logger.info("Bot(${uin}) register")
}

fun destroy(uin: Long) {
    SessionManager.close(uin)
}